package pers.hongze.test.task;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class cronJobsController {

    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");

    //每隔三秒执行一次任务
    @Scheduled(fixedRate = 3000)
    public void cronJobs(){
        System.out.println("时间为：" + dateFormat.format(new Date()));
    }
}
